//
//  import.cpp
//  
//
//  Created by Nikita Luzyanin on 30.11.13.
//
//

#include <iostream>
#include <fstream>
#include <iomanip>
#include <stdlib.h>
#include "functions.cpp"
using namespace std;

int main(int argc, char* argv[])
{
    char *pathToFS;
    pathToFS = argv[1];
    FILE *f;
    f = fopen(pathToFS, "rb");
    if (f == NULL) {
        cout << "Path to FS does not exist\n";
        return 1;
    }
    fclose(f);
    
    char pathToRoot[1000];
    strcpy(pathToRoot, pathToFS);
    strcat(pathToRoot, "/0");
    f = fopen(pathToRoot, "rb");
    if (f == NULL) {
        cout << "FS is not formatted\n";
        return 1;
    }
    fclose(f);
    
    char pathToSrc[1000], pathToDst[1000];
    strcpy(pathToSrc, argv[2]);
    strcpy(pathToDst, argv[3]);
    
    if (copySrcToDst(pathToFS, pathToSrc, pathToDst) != 0) {
        cout << "Mistake\n";
        return 1;
    }
    
    return 0;
}